var SQLite = {
    maDBConn: '',
    
    //Connecting to the database
    start: function(fileName) {
        try {
            var file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile);
            file.append(fileName+'.db');
            
            var storageService = Components.classes["@mozilla.org/storage/service;1"].getService(Components.interfaces.mozIStorageService);
            SQLite.maDBConn = storageService.openDatabase(file);
            
            //If the database doesn't exist, we create it
            SQLite.sql('CREATE TABLE IF NOT EXISTS twits (url VARCHAR(255));');
            
            return SQLite;
        } catch(ex) {
            return '';
        }
    },
    
    //Launching a query (with returned value)
    query: function(sql) {
        if (SQLite.maDBConn == '') return false;
        
        try {
            return SQLite.maDBConn.createStatement(sql);
        } catch(ex) {
            return false;
        }
    },
    
    //Launching a query (without returned value)
    sql: function(query) {
        if (SQLite.maDBConn == '') return false;
        
        try {
            SQLite.maDBConn.executeSimpleSQL(query);
            return true;
        } catch(ex) {
            return false;
        }
    }
}